﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Word = Microsoft.Office.Interop.Word;

namespace WordTemplate2.Pannel
{
    public partial class FootNoteForm : Form
    {
        public FootNoteForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool flag = Globals.ThisDocument.IsNumeric(textBox1.Text);

            if (flag)
            {
                object move = Word.WdMovementType.wdMove;
                object extend = Word.WdMovementType.wdExtend;
                object line = Word.WdUnits.wdLine;
                object character = Word.WdUnits.wdCharacter;
                object number = 1;
                object number_length = textBox1.Text.Length + 1;


                Globals.ThisDocument.Application.Selection.TypeText(textBox1.Text + ")");
                Globals.ThisDocument.Application.Selection.MoveLeft(ref character, ref number_length, ref extend);
                Word.Font f = Globals.ThisDocument.Application.Selection.Font;

                f.NameFarEast = "宋体";
                f.NameAscii = "宋体";
                f.NameOther = "宋体";
                f.Name = "宋体";
                f.Size = 4.5f;
                f.Bold = 0;
                f.Italic = 0;
                f.Underline = Word.WdUnderline.wdUnderlineNone;
                f.UnderlineColor = Word.WdColor.wdColorAutomatic;
                f.StrikeThrough = 0;
                f.DoubleStrikeThrough = 0;
                f.Outline = 0;
                f.Emboss = 0;
                f.Shadow = 0;
                f.Hidden = 0;
                f.SmallCaps = 0;
                f.AllCaps = 0;
                f.Color = Word.WdColor.wdColorAutomatic;
                f.Engrave = 0;
                f.Superscript = 0;
                f.Subscript = 0;
                f.Spacing = 0;
                f.Scaling = 100;
                f.Position = 4;
                f.Kerning = 0;
                f.Animation = Word.WdAnimation.wdAnimationNone;
                f.DisableCharacterSpaceGrid = false;
                f.EmphasisMark = Word.WdEmphasisMark.wdEmphasisMarkNone;


                this.Visible = false;
                this.Close();
            }
            else
            {
                MessageBox.Show("必须输入数字");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            this.Close();
        }
    }
}
